import {
  IsBoolean,
  IsEmail,
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
  Length,
} from 'class-validator';

export class UpdateUserDto {
  @IsNotEmpty({ message: '用户ID不能为空' })
  @IsNumber({}, { message: '用户ID必须是数字' })
  id: number;

  @IsOptional()
  @IsString({ message: '用户名必须是字符串' })
  @Length(2, 50, { message: '用户名长度应在6-50个字符之间' })
  username?: string;

  @IsOptional()
  @IsString({ message: '手机号必须是字符串' })
  @Length(11, 11, { message: '手机号必须是11位' })
  phoneNumber?: string;

  @IsOptional()
  @IsEmail({}, { message: '邮箱格式不正确' })
  email?: string;

  @IsOptional()
  @IsBoolean({ message: '冻结状态必须是布尔值' })
  isFrozen?: boolean;

  @IsOptional()
  @IsString({ message: '头像地址必须是字符串' })
  avatar?: string;
}
